
#ifndef TD_CORE_UTILS_H_
#define TD_CORE_UTILS_H_


/************************************************************************/
/* STL                                                                  */
/************************************************************************/
#include <string>
#include <sstream>
#include <exception>

using namespace std;

namespace TD_Core {

	class Utils {

	public:

		/************************************************************************/
		/* ctors and dtors					                                    */
		/************************************************************************/
		//Default constructor
		explicit Utils();

		//Copy constructor
		explicit Utils(const Utils &rhs);

		//Assignment constructor
		Utils & operator=(const Utils &rhs);

		//Destructor
		~Utils();

		static inline string intToStr(int cInt) {
			stringstream os;
			os << cInt;
			return(os.str());
		}

		static inline int randomNumber(int maxNum) {
			return(rand() % maxNum);
		}

		template<typename T>
		static inline void safeDelete(T * dMem) {
			T * pT = (T*)(dMem);
			if(pT != NULL) { //NICHT WERKING
				delete pT;
				pT = NULL;
			} else if(dMem != NULL) { //characterizes an invalid argument	 
				#ifndef _WII
					throw bad_exception("Safe delete invalid argument exception\n!");
				#endif
			}
		}
	};
}
#endif